package personresources.manager.listener;

import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;

import org.apache.myfaces.application.ActionListenerImpl;

import personresources.manager.util.CommonUtils;
/**
 * Catch exception
 * @author Duy Chuong
 *
 */
public class ExceptionListener extends ActionListenerImpl implements ActionListener {

	/**
	 * process action and catch exception
	 * 
	 */
	public void processAction(ActionEvent event) throws AbortProcessingException {

		try {
			super.processAction(event);
		} catch (Exception ex) {
			System.out.println("Bat loi roi kaka");
			ex.printStackTrace();
			FacesContext context = FacesContext.getCurrentInstance();
			CommonUtils.doBackError(context, null);
		}

	}

}
